Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 4 - Geometric Operations / Geometric Operations Reference
Functions / Performing Geometric Arithmetic With Shapes


GXIntersectRectangle

You can use the GXIntersectRectangle function to find the intersection of two rectangles.

gxBoolean GXIntersectRectangle(gxRectangle *target, 
                               const gxRectangle *source, 
                               const gxRectangle *operand);
target
A pointer to a gxRectangle structure. On return, the intersection of the source and operand rectangles. You may specify the value nil for this parameter if you do not want the intersection to be calculated. Depending on the result of the intersection operation, this pointer may point to the source or operand rectangle.
source
A pointer to one of the rectangles to intersect.
operand
A pointer to the other rectangle to intersect.
function result
A Boolean value indicating whether the rectangles intersect.
DESCRIPTION
The GXIntersectRectangle function returns true as its function result if the source rectangle and the operand rectangle intersect, and returns false otherwise.

If you provide a pointer for the target parameter that is not nil, this function returns the intersection of the source and operand rectangles in the gxRectangle structure pointed to by the target parameter.

If the source rectangle and the operand rectangle do not intersect or share only one edge, this function returns false and does not affect the target rectangle.

You may specify the source rectangle or the operand rectangle as the target rectangle. In this case, the function calculates the intersection of the original rectangles and then places the calculated intersection into the source or operand rectangle, as specified.

Notice that the parameters to this function are not shapes; they are pointers to gxRectangle data structures.

ERRORS, WARNINGS, AND NOTICES
Errors
parameter_is_nil
SEE ALSO
For a discussion of the gxRectangle data structure, see Chapter 2, "Geometric Shapes."

For a discussion of geometric arithmetic, see "Geometric Arithmetic" beginning on page 4-21.

To find the intersection of two shapes, use the GXIntersectShape function, described on page 4-107.

To find the union of two rectangles, use the GXUnionRectangle function, described in the next section.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help